<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <div>
        <a v-link="{path:'/home'}">Home</a>
        <a v-link="{path:'/about'}">About</a>
    </div>
    <router-view></router-view>
    <template id="newsDetail">

        <div>
        News Detail -{{$route.params.ddd}},{{$route.params.aaa}}
        </div>
    </template>
    <template id="home">
        <div><h1>Home</h1><p>{{msg}}</p></div>
        <div>
            <ul class="nav nav-tabs">
                <li>
                    <a v-link="{path:'/home/news'}">News</a>
                </li>
                <li>
                    <a v-link="{path:'/home/message'}">Message</a>
                </li>
            </ul>
            <router-view></router-view>
        </div>
    </template>
    <template id="news">
        <ul>
            <li>
                <a v-link="{path:'/home/news/detail/1'}">News 1</a>
            </li>
            <li>
                <a v-link="{path:'/home/news/details/2'}">News 2</a>
            </li>
            <li>
                <a v-link="{path:'/home/news/details/3'}">News 3</a>
            </li>
        </ul>
        <router-view></router-view>
    </template>
    <template id="message">
        <ul>
            <li>Message 01</li>
            <li>Message 02</li>
            <li>Message 03</li>
        </ul>
    </template>
</div>
</body>
<script src="vue.js"></script>
<script src="vue-router.min.js"></script>
<script>
    var Home = Vue.extend({
        template:'#home',
        data:function () {
          return { msg:'Hello,vue router!'}
        }
    });
    var News = Vue.extend({
        template:'#news'
    });
    var Message = Vue.extend({
        template:'#message'
    });
    var About = Vue.extend({
        template:'<div><h1>About</h1><p>This is tutorial about vue-router</p></div>'
    });
    var NewsDetail = Vue.extend({
        template:'#newsDetail'
    });
    var router = new VueRouter();
    router.map({
        '/home':{
            component:Home,
            subRouter: {
                '/news': {
                    name: 'news',
                    component: News,
                    subRouter: {
                        'detail/:dddd/aaa': {
                            name: 'detail',
                            component: NewsDetail
                        },
                        'detail/:dddd':{
                            name:'detail1',
                            component:NewsDetail
                        }
                    }
                },
                '/message': {
                    component: Message
                }
            }
    },
        '/about':{
        component:About
        }
        });
    var App = Vue.extend({});
    router.start(App,'#app')

</script>
</html>